<template>
  <!-- 查询筹措组 -->
  <div>
    <TopFilter :list="financingTopFilterList" :cols="3" @filterChange="changeHandle" @onCollapse="collapseHandle"></TopFilter>
    <FormPanel ref="form" :list="form" :cols="4" labelWidth="120" :isSubmitBtn="false" @formChange="formchangeFun" />
    <FilterTable ref="table" columnsRef="waxfinancingformA" :columns="columns" :params="fetchParams" :datakey="'records'" :onColumnsChange="columns => (this.columns = columns)">
      <!-- :fetchapi="fetchApi" -->
      <template slot="controls" slot-scope="props">
        <!-- <el-button size="small" type="primary" icon="el-icon-add" :disabled="searchBtn" @click="handleSearch">曾查配件号</el-button> -->
        <el-button size="small" type="primary" icon="el-icon-daochu" :disabled="exportBtn" @click="handleExport">导出</el-button>
        <el-button size="small" type="primary" icon="el-icon-printer" :disabled="printBtn" @click="handlePrint">打印</el-button>
        <!-- <el-button size="small" type="primary" icon="el-icon-plus" @click="publishInfo">新建</el-button>
        <AjaxButton :click="pushDialog" type="primary">发布</AjaxButton>
        <AjaxButton :click="offlineDialog" type="primary">下线</AjaxButton> -->
      </template>
    </FilterTable>
    <BaseDialog :visible.sync="visible" destroyOnClose :title="dialogTitle" :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <finance @close="closeDialog" @onConfirm="confirmHandle" />
    </BaseDialog>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import finance from './finance.vue';
export default {
  name: 'ReplaceAndInventory',
  components: { finance },
  mixins: [dictionary],
  props: [],
  data() {
    return {
      financingTopFilterList: this.createReplaceAndInventionTopFilterList(),
      columns: this.createTableList(),
      fetchParams: { xhrAbort: true },
      exportBtn: false,
      printBtn: false,
      searchBtn: false,
      visible: false,
      dialogTitle: '查询筹措组',
      form: this.createFormList()
    };
  },
  methods: {
    confirmHandle(value) {},
    //
    formchangeFun() {},
    // 关闭弹窗
    closeDialog() {
      this.visible = false;
    },
    // 点击配件进行搜索
    searchPartsHandle() {
      this.visible = true;
    },
    // 曾查配件号
    handleSearch() {
      this.visible = true;
    },
    // 打印处理
    handlePrint() {},
    // 导出处理
    handleExport() {},
    // 展开收起调用函数
    collapseHandle() {},
    // 搜索条件改变调用方法
    changeHandle() {},

    //
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '筹措组',
          fieldName: 'storageName',
          disabled: true
        },
        {
          type: 'INPUT',
          label: 'ABC标识',
          fieldName: 'abc',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '体积标识',
          fieldName: 'storageName1',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '价值标识',
          fieldName: 'a1',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '重量标识',
          fieldName: 'a2',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '保质期标识',
          fieldName: 'a3',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数1',
          fieldName: 'a4',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数2',
          fieldName: 'storageName2',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数3',
          fieldName: 'storageName3',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数4',
          fieldName: 'storageName4',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数5',
          fieldName: 'storageName5',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '环比参数6',
          fieldName: 'storageName6',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '同比参数',
          fieldName: 'storageName7',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '库存深度下限(天)',
          // labelWidth: '80',
          fieldName: 'storageName8',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '库存深度上限(天)',
          // labelWidth: '100',
          fieldName: 'storageName9',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '安全库存(天)',
          fieldName: 'storageName11',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '建储标识',
          fieldName: 'storageName12',
          disabled: true
        },
        {
          type: 'INPUT',
          label: 'C类件低储(数量)',
          // labelWidth: '80',
          fieldName: 'storageName13',
          disabled: true
        },
        {
          type: 'INPUT',
          label: 'C类件高储(数量)',
          // labelWidth: '80',
          fieldName: 'storageName14',
          disabled: true
        }
      ];
    },
    // 创建表单字段列表
    createTableList() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '筹措组代码',
          dataIndex: 'brand',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '主组号',
          dataIndex: 'partNo',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件代码',
          dataIndex: 'partName',
          sorter: true,
          filter: true,
          filterType: 'input',
          filterItems: []
        },
        {
          title: '厂家配件代码',
          dataIndex: 'discription',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件名称',
          dataIndex: 'incomingPayment',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '计量单位',
          dataIndex: 'costPrice',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '开口件代码',
          dataIndex: 'salePrice',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '采购单价',
          dataIndex: 'retailPrice',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '加价率',
          dataIndex: 'stockQuatity',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '出库单价',
          dataIndex: 'usableQuatity',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '销售单价',
          dataIndex: 'one',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '批发单价',
          dataIndex: 'two',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '替换件代码',
          dataIndex: 'three',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '常用件标识',
          dataIndex: 'packageInfo',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [
            { text: '是', value: '1' },
            { text: '否', value: '0' }
          ]
        },
        {
          title: '配件分类代码',
          dataIndex: 'fibType',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件分类说明',
          dataIndex: 'markupGroup',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车型代码',
          dataIndex: 'monthlySales',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车型名称',
          dataIndex: 'monthlySalesLimit',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '停用标识',
          dataIndex: 'safetyStock',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('1004')
        },
        {
          title: '停用日期',
          dataIndex: 'availableStock',
          sorter: true,
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '包装单位',
          dataIndex: 'unitCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '包装单位名称',
          dataIndex: 'changchunLibraryInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车系',
          dataIndex: 'beijingInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: 'ABC分类',
          dataIndex: 'guangzhouStock',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('8092'),
          dictItems: this.createDictList('8092')
        },
        {
          title: '体积标识',
          dataIndex: 'xianLibraryInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '体积',
          dataIndex: 'jinanInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '重量标识',
          dataIndex: 'wuhanInventory',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('1004')
        },
        {
          title: '重量',
          dataIndex: 'xinjiangInventory',
          sorter: true,
          filter: true,
          filterType: 'number'
        },
        {
          title: '价值标识',
          dataIndex: 'chengduInventory',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('1004')
        },
        {
          title: '价值单位',
          dataIndex: 'dalianInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '保质期',
          dataIndex: 'eastChinaInventory',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '采购锁',
          dataIndex: 'purchase',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '销售锁',
          dataIndex: 'sale',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '不建储标识',
          dataIndex: 'sadf',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('1004')
        },
        {
          title: '不建储原因',
          dataIndex: 'sasdf',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '下载标识',
          dataIndex: 'saweqw',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList('1004')
        }
      ];
    },
    // 创建筛选条件
    createReplaceAndInventionTopFilterList() {
      return [
        {
          type: 'INPUT',
          label: '筹措组',
          fieldName: 'partNo',
          placeholder: '',
          rules: [{ required: true, message: '请选择...', trigger: 'blur' }],
          unitRender: () => {
            return <el-button slot="append" icon="el-icon-search" onClick={this.searchPartsHandle}></el-button>;
          }
        }
      ];
    }
  }
};
</script>

<style></style>
